/**
 * Created by zhengjiachao on 2017/4/26.
 */
(function() {
    ADF.actionModel.UndoModel = function() {
        ADF.actionModel.UndoModel.superclass.constructor.call(this);
        this.config = {text:"撤销",icon:"icon-chexiao"};
        this.id = "undo";
        this.hotkeyInfo = {
            type : "keydown",
            ctrlKey : true,
            key : "z"
        }
    };

    COM.util.defineClass(ADF.actionModel.UndoModel, AGEF.ActionModel, {
        execute: function(graphicalViewer){
            var domain = graphicalViewer.getEditDomain();
            var stack = domain.getCommandStack();
            if(stack.canUndo()) stack.undo();
        },
        getEnabledState : function(graphicalViewer){
            var domain = graphicalViewer.getEditDomain();
            var stack = domain.getCommandStack();
            return stack.canUndo();
        }
    });
})();